package com.cby.android.sample.model

import android.app.Application
import com.cby.android.library.base.BasePageStateViewModel
import com.cby.android.sample.bean.MetaImageBean
import com.cby.android.sample.bean.roll.RollNewsInfoBean
import com.cby.android.sample.repository.MetaApiImpl
import com.cby.android.sample.repository.RollApiImpl

/**
 * @description: RollNewsViewModel
 *
 * @author ChenBaoyang
 * @date 4/28/21 17:47
 */
class SquareListViewModel(application: Application) : BasePageStateViewModel<MetaImageBean>(application){

    private val metaApi = MetaApiImpl()

    var keyword: String? = null

    override suspend fun loadPageData(page: Int): MutableList<MetaImageBean> {
        val response = metaApi.loadMetaImages(keyword!!, page, 20)
        return if(response.list.isEmpty()) mutableListOf() else response.list as MutableList<MetaImageBean>
    }


}